package com.cicc.wm.lock.redis;


import com.cicc.wm.lock.config.LockProperties;
import org.redisson.Redisson;
import org.redisson.api.RedissonClient;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * redis锁自动配置
 */
@Configuration
@ConditionalOnClass(Redisson.class)
@EnableConfigurationProperties(LockProperties.class)
public class RedisLockAutoConfiguration {

    @Bean
    public RedisLockRegistry redisLockRegistry(RedissonClient redissonClient) {
        return new RedisLockRegistry(redissonClient);
    }
}
